<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"                  
                xmlns:f="http://java.sun.com/jsf/core"  
                xmlns:p="http://primefaces.org/ui"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                template="./default_template.xhtml">

    <ui:define name="content">
        <f:view>
            <h:form rendered="#{userController.utilisateur.typeUser == 'Admin'}" class="span4">
                <h2><h:outputText value="Créer un utilisateur"/></h2>
                <h:panelGrid columns="2">
                    <h:inputText id="login" value="#{userController.login}" title="Login" />
                    <p:watermark for="login" value="Login" /> 
                    <h:inputText id="nom" value="#{userController.nom}" title="Nom" />
                    <p:watermark for="nom" value="Nom" /> 
                    <h:inputText id="pwd" value="#{userController.password}" title="Pwd" />
                    <p:watermark for="pwd" value="Mot de passe" />
                    <h:selectOneMenu value="#{userController.typeU}">
                        <f:selectItem itemValue="Client" itemLabel="Client" />
                        <f:selectItem itemValue="Admin" itemLabel="Admin" />
                    </h:selectOneMenu>
                </h:panelGrid>
                <h:commandButton class="btn btn-large btn-primary pull-right" style="margin-top: 20px;" id="enregistrer" value="Créer" action="#{userController.createUserAction()}"/>
            </h:form>
            <h:form rendered="#{userController.utilisateur.typeUser == 'Client'}"  class="span4">
                <h2><h:outputText value="Modifier profil"/></h2>
                <h:panelGrid columns="2">
                    Login :
                    <h:inputText id="login" value="#{userController.utilisateur.login}" title="Login" />
                    Nom :
                    <h:inputText id="nom" value="#{userController.utilisateur.nom}" title="Nom" />
                    Mot de passe :
                    <h:inputSecret id="pwd" value="#{userController.utilisateur.pwd}" title="Pwd" />
                </h:panelGrid>
                <h:commandButton class="btn btn-large btn-primary pull-right" id="update" style="margin-top: 20px;" value="Mettre à jour" action="#{userController.updateUserAction()}"/>
            </h:form>
        </f:view>
    </ui:define>

</ui:composition>
